<?php

namespace Search\Search360;

use Search\SearchResult;

class Search360Result implements SearchResult
{
    private string $title;
    private string $content;

    public function __construct(string $title, string $content)
    {
        $this->ensure($title, $content);
        $this->title = $title;
        $this->content = $content;
    }

    public function getTitle(): string
    {
        return $this->title;
    }

    public function getContent(): string
    {
        return $this->content;
    }

    private function ensure(string $title, string $content): void
    {
        if ('' === $title) {
            throw new Search360Exception('Title cannot be empty!');
        }
        if ('' === $content) {
            throw new Search360Exception('Content cannot be empty!');
        }
    }
}
